package assertTools;

import exceptionTools.InvariantExc;
import exceptionTools.PostconditionExc;
import exceptionTools.PreconditionExc;

//TODO: Peut-être devrions nous ajouter un paramètre aux méthodes
// pour préciser un peu plus l'origine de l'erreur...

public class DecoratorTools {
	public static void checkPre(boolean b) throws PreconditionExc{
		if(!b)
			throw new PreconditionExc("Pre Failed");
	}
	
	public static void failurePre() throws PreconditionExc{
		throw new PreconditionExc("Pre Failed");
	}
	
	public static void checkPost(boolean b) throws PostconditionExc{
		if(!b)
			throw new PostconditionExc("Post Failed");
	}
	
	public static void failurePost() throws PostconditionExc{
		throw new PreconditionExc("Post Failed");
	}
	
	public static void checkInv(boolean b) throws InvariantExc{
		if(!b)
			throw new InvariantExc("Invariant Failed");
	}
	
	public static void failureInvariant() throws InvariantExc{
		throw new InvariantExc("Invariant Failed");
	}
}
